package org.beetl.sql.core;

import org.beetl.sql.core.annotatoin.Table;
import org.beetl.sql.core.kit.StringKit;

/***
 * 下划线命名转换 数据库 SYS_USER,sys_user,对应类SysUser,列USER_ID,user_Id,对应属性userId
 * 数据库表名和列名都大写.
 * 
 * @author xiandafu
 * @author Gavin
 * @author zhoupan
 *
 */
public class StandardNameConversion extends NameConversion {
 public String getTableName(Class<?> c) {
  Table table = c.getAnnotation(Table.class);
  if (table != null) {
   return table.name();
  }
  return StringKit.enCodeUnderlined(c.getSimpleName()).toUpperCase();
 }

 public String getClassName(String tableName) {
  String temp = StringKit.deCodeUnderlined(tableName.toLowerCase());
  return StringKit.toUpperCaseFirstOne(temp);
 }

 
 public String getColName(Class<?> c, String attrName) {
  return StringKit.enCodeUnderlined(attrName).toUpperCase();
 }

 
 public String getPropertyName(Class<?> c, String colName) {
  return StringKit.deCodeUnderlined(colName.toLowerCase());
 }
}
